
<%@ page import="sistema.Venda" %>
<!doctype html>
<html>
  <head>
    <meta name="layout" content="main">
  <g:set var="entityName" value="${message(code: 'venda.label', default: 'Venda')}" />
  <title><g:message code="default.show.label" args="[entityName]" /></title>
</head>
<body>
  <a href="#show-venda" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
  <div class="nav" role="navigation">
    <ul>
      <li><g:link class="home" controller="admin" action="index">Home</g:link></li>
      <li><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
      <li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
    </ul>
  </div>
  <div id="show-venda" class="content scaffold-show" role="main">
    <h1>Informações Venda</h1>
    <g:if test="${flash.message}">
      <div class="message" role="status">${flash.message}</div>
    </g:if>

    <div style="margin: 20px 0 10px 20px">
      <h3>  
        Vendedor: <g:link controller="vendedor" action="show" id="${vendaInstance?.vendedor?.id}">${vendaInstance?.vendedor?.encodeAsHTML()}</g:link>
        </br>
        Data Venda:  <g:formatDate format="dd/MM/yyyy" date="${vendaInstance?.dateCreated}" />
      </h3>
      <table id="newspaper-a">
        <thead>
          <tr>
            <th scope="col">Cod Barra</th>
            <th scope="col">Categoria</th>
            <th scope="col">Cor</th>
            <th scope="col">Modelo</th>
            <th scope="col">Quantidade</th>
            <th scope="col">Custo Varejo</th>
            <th scope="col">Custo Soma</th>
          </tr>
        </thead>
        <tbody>
        <g:each in="${listProd}">
          <tr>
            <td>${it.produto.codBarra}</td>
            <td>${it.produto.categoria}</td>
            <td>${it.produto.cor}</td>
            <td>${it.produto.modelo}</td>
            <td>${it.qtdProduto}</td>
            <td style="text-align: right"><g:moeda valor="${it.produto.custoVarejo}"/></td>
          <td style="text-align: right"><g:moeda valor="${it.valorTotalProd}"/></td>
          </tr>
        </g:each>
        </tbody>
        <thead>
          <tr>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
            <th></th>
            <th scope="col">TOTAL DA COMPRA</th>
            <th style="text-align: right;"><g:moeda valor="${vendaInstance.valorTotal}" /></th>
        </tr>
        </thead>
      </table>
        <g:link action="recibo" target="blank" id="${vendaInstance?.id}"><img title="IMPRIMIR COMPROVANTE DE VENDA" width="50" src="${resource(dir:'images', file:'impressora.png')}"/></g:link>
    </div>
    <g:form>
      <fieldset class="buttons">
        <g:hiddenField name="id" value="${vendaInstance?.id}" />
        <g:link class="edit" action="edit" id="${vendaInstance?.id}"><g:message code="default.button.edit.label" default="Edit" /></g:link>
        <g:actionSubmit class="delete" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('Deseja realmente remover esta venda? Essa ação irá retornar os produtos para o estoque.');" />
      </fieldset>
    </g:form>
  </div>
</body>
</html>
